package br.com.duosoftware.daos;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Daniel
 *
 */
public class ConnectionFactory {

    private static final String URL = "jdbc:postgresql://localhost:5432/curso_java";
    private static final String USER = "postgres";
    private static final String PASS = "123456";

    public static Connection getConnection() {

        

        Connection connection = null;

        try {

            Class.forName("org.postgresql.Driver");
            
            connection = DriverManager.getConnection(URL, USER, PASS);

        } catch (SQLException ex) {

            Logger.getLogger(ConnectionFactory.class.getName()).log(Level.SEVERE, null, ex);

        } catch (ClassNotFoundException ex) {
            
            Logger.getLogger(ConnectionFactory.class.getName()).log(Level.SEVERE, null, ex);
            
        }

        return connection;

    }

}
